<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后端开发 - 我的个人博客</title>
    <link rel="stylesheet" href="assets/css/style.css">
    <script src="assets/js/jquery.js"></script>
    <script src="assets/js/main.js" defer></script>
</head>
<body>
    <header>
        <nav class="main-nav">
            <div class="logo">
                <h1><a href="index.html">我的博客</a></h1>
            </div>
            <ul class="nav-menu">
                <li class="nav-item">
                    <a href="#" class="nav-link active">技术分享</a>
                    <ul class="submenu">
                        <li><a href="frontend.html">前端开发</a></li>
                        <li><a href="backend.html" class="active">后端开发</a></li>
                        <li><a href="tools.html">开发工具</a></li>
                    </ul>
                </li>
                <li class="nav-item">
                    <a href="#" class="nav-link">生活随笔</a>
                    <ul class="submenu">
                        <li><a href="travel.html">旅行日记</a></li>
                        <li><a href="food.html">美食推荐</a></li>
                    </ul>
                </li>
                <li class="nav-item">
                    <a href="#" class="nav-link">关于我</a>
                    <ul class="submenu">
                        <li><a href="profile.html">个人简介</a></li>
                        <li><a href="contact.html">联系方式</a></li>
                    </ul>
                </li>
            </ul>
            <button id="theme-toggle" class="theme-toggle">
                <span class="light-icon">☀️</span>
                <span class="dark-icon">🌙</span>
            </button>
        </nav>
    </header>

    <main>
        <div class="page-header">
            <h2>后端开发</h2>
            <p>分享服务器端开发技术和架构设计经验</p>
        </div>

        <div class="content-grid">
            <div class="main-content">
                <div class="search-box">
                    <input type="text" placeholder="搜索后端文章..." id="search-input">
                    <button type="button" id="search-btn">搜索</button>
                </div>

                <article class="blog-post">
                    <div class="post-item" data-category="backend">
                        <div class="post-header">
                            <h3>微服务架构设计实践</h3>
                            <div class="post-meta">
                                <span class="post-date">2024-01-20</span>
                                <span class="post-views">阅读: 456</span>
                                <span class="post-category">分类: 架构设计</span>
                            </div>
                        </div>
                        <img src="https://picsum.photos/800/400?random=13" alt="文章配图" class="post-image">
                        <div class="post-content">
                            <h4>什么是微服务？</h4>
                            <p>微服务是一种将应用程序构建为一组小型自治服务的架构风格。每个服务运行在自己的进程中，并使用轻量级机制通信。</p>
                            <h4>微服务的优势</h4>
                            <ul>
                                <li>服务独立部署</li>
                                <li>技术栈灵活选择</li>
                                <li>故障隔离</li>
                                <li>扩展性好</li>
                            </ul>
                            <h4>实现示例</h4>
                            <pre><code>
@Service
public class UserService {
    @Autowired
    private RestTemplate restTemplate;

    public UserDTO getUserInfo(Long userId) {
        // 调用用户服务
        UserDTO user = restTemplate.getForObject(
            "http://user-service/users/" + userId,
            UserDTO.class
        );
        
        // 调用订单服务
        List<OrderDTO> orders = restTemplate.getForObject(
            "http://order-service/orders/user/" + userId,
            List.class
        );

        user.setOrders(orders);
        return user;
    }
}
                            </code></pre>
                        </div>
                        <div class="post-tags">
                            <span class="tag">微服务</span>
                            <span class="tag">架构设计</span>
                            <span class="tag">Spring Cloud</span>
                        </div>
                    </div>

                    <div class="post-item" data-category="backend">
                        <div class="post-header">
                            <h3>Redis性能优化指南</h3>
                            <div class="post-meta">
                                <span class="post-date">2024-01-18</span>
                                <span class="post-views">阅读: 389</span>
                                <span class="post-category">分类: 数据库</span>
                            </div>
                        </div>
                        <img src="https://picsum.photos/800/400?random=14" alt="文章配图" class="post-image">
                        <div class="post-content">
                            <h4>Redis性能优化要点</h4>
                            <p>Redis作为高性能的内存数据库，需要合理配置和使用才能发挥最大性能。</p>
                            <pre><code>
# Redis配置优化示例
maxmemory 2gb
maxmemory-policy allkeys-lru
appendonly yes
appendfsync everysec
                            </code></pre>
                            <h4>常见性能问题及解决方案</h4>
                            <ul>
                                <li>内存碎片处理</li>
                                <li>网络延迟优化</li>
                                <li>持久化策略选择</li>
                                <li>数据结构优化</li>
                            </ul>
                        </div>
                        <div class="post-tags">
                            <span class="tag">Redis</span>
                            <span class="tag">性能优化</span>
                            <span class="tag">缓存</span>
                        </div>
                    </div>
                </article>

                <!-- 评论区 -->
                <div class="comments-section">
                    <h3>评论</h3>
                    <div class="comment-form">
                        <form id="commentForm">
                            <div class="form-group">
                                <input type="text" id="commenterName" placeholder="您的昵称" required>
                            </div>
                            <div class="form-group">
                                <textarea id="commentContent" placeholder="写下您的评论..." required></textarea>
                            </div>
                            <button type="submit" class="submit-btn">发表评论</button>
                        </form>
                    </div>
                    <ul class="comment-list"></ul>
                </div>
            </div>

            <aside class="sidebar">
                <!-- 文章目录 -->
                <div class="post-toc widget">
                    <h3>文章目录</h3>
                    <ul class="toc-list">
                        <li><a href="#microservice">微服务架构设计实践</a></li>
                        <li><a href="#redis">Redis性能优化指南</a></li>
                    </ul>
                </div>

                <!-- 热门文章 -->
                <div class="popular-posts widget">
                    <h3>热门文章</h3>
                    <ul class="popular-list">
                        <li class="popular-item">
                            <img src="https://picsum.photos/50/50?random=15" alt="热门文章配图" class="popular-image">
                            <div class="popular-content">
                                <h4>微服务架构设计实践</h4>
                                <span class="popular-views">阅读: 456</span>
                            </div>
                        </li>
                    </ul>
                </div>

                <!-- 标签云 -->
                <div class="tags-widget widget">
                    <h3>标签云</h3>
                    <div class="tag-cloud">
                        <a href="#" class="tag-item" style="font-size: 1.4em">Spring</a>
                        <a href="#" class="tag-item" style="font-size: 1.2em">Redis</a>
                        <a href="#" class="tag-item" style="font-size: 1.6em">微服务</a>
                        <a href="#" class="tag-item">MySQL</a>
                        <a href="#" class="tag-item" style="font-size: 1.3em">Docker</a>
                        <a href="#" class="tag-item">Java</a>
                    </div>
                </div>
            </aside>
        </div>
    </main>

    <footer>
        <p>&copy; 2024 我的个人博客. All rights reserved.</p>
    </footer>

    <script src="assets/js/jquery.js"></script>
    <script src="assets/js/main.js"></script>
    <script src="assets/js/article-list.js"></script>
</body>
</html> 